{extend name="public/base" /}

{block name="title"}<title>{$Think.lang.list}</title>{/block}

{block name="pjax_container"}
<section class="content-header">
    <h1>监犯列表</h1>
    <ol class="breadcrumb">
        <li class="active"><i class="fa fa-dashboard"></i> 监犯列表</li>
    </ol>
</section>
<section class="content">
    <div class="row">
        <div class="col-md-12">
            <div class="box box-primary">
                <div class="box-header with-border">
                    <h3 class="box-title"></h3>
                    <div class="pull-left">
                        {:authAction(CONTROLLER_NAME.'/create', 'create')} 
                        {:authAction(CONTROLLER_NAME.'/delete', 'delete_all')} 
                        {:authAction(CONTROLLER_NAME.'/import', 'import')} 
                        {:authAction(CONTROLLER_NAME.'/downloadfix', 'downloadfix')} 
                        {:authAction(CONTROLLER_NAME.'/downloadactive', 'downloadactive')} 
                        {:authAction(CONTROLLER_NAME.'/download', 'download')} 
                    </div>
                    {include file="public/search" /}
                </div>
                <div class="box-body table-responsive">
                    <table class="table table-bordered table-hover table-sort">
                        <tr>
                            <th width="35"><input type="checkbox" class="minimal checkbox-toggle"></th>
                            <th>{$Think.lang.id}{:table_sort('id')}</th>
                            <th>{$Think.lang.number}</th>
                            <th>{$Think.lang.name}</th>
                            <th>{$Think.lang.age}{:table_sort('age')}</th>
                            <th>{$Think.lang.race}</th>
                            <th>{$Think.lang.charge}</th>
                            <th>{$Think.lang.sentence}</th>
                            <th>{$Think.lang.prison_area}</th>
                            <th>{$Think.lang.chain}</th>
                            <th>{$Think.lang.location}</th>
                            <th>{$Think.lang.risk}</th>
                            <th>{$Think.lang.captains}</th>
                            <th>{$Think.lang.fixcode_src}</th>
                            <th>{$Think.lang.activecode}</th>
                            <th width="204">{$Think.lang.action}</th>
                        </tr>
                        {volist name="dataList" id="vo"}
                        <tr>
                            <td style="vertical-align:middle"><input type="checkbox" name="id[]" value="{$vo.id}" class="minimal"></td>
                            <td style="vertical-align:middle">{$vo.id}</td>
                            <td style="vertical-align:middle">
                                {$vo.number}
                            </td>
                            <td style="vertical-align:middle">
                                {$vo.name}
                            </td>
                            <td style="vertical-align:middle">
                                {$vo.age}
                            </td>
                            <td style="vertical-align:middle">{$vo.race}</td>
                            <td style="vertical-align:middle">{$vo.charge}</td>
                            <td style="vertical-align:middle">{$vo.sentence}</td>
                            <td style="vertical-align:middle">{$vo.prison_area}</td>
                            <td style="vertical-align:middle">{$vo.chain}</td>
                            <td style="vertical-align:middle">{$vo.location}</td>
                            <td style="vertical-align:middle">{$vo.risk}</td>
                            <td style="vertical-align:middle">{$vo.captains}</td>
                            <td style="vertical-align:middle"><a href="{:url($vo['fixcode_src'])}" target="_blank"><img src="{$vo->fixcode_src}" style="width:50px;border-radius:50%;" /></a></td>
                            <td style="vertical-align:middle">
                            <a href="{:url($vo['activecode'])}" target="_blank"><img src="{$vo->activecode}" style="width:50px;border-radius:50%;" /></a></td>
                            <td style="vertical-align:middle">
                                {:authAction(CONTROLLER_NAME.'/fixcode', 'fixcode', $vo.id)}
                                {:authAction(CONTROLLER_NAME.'/activecode', 'activecode', $vo.id)}
                                {include file="public/list_action" /}
                            </td>
                        </tr>
                        {/volist}
                    </table>
                </div>
                <div class="box-footer clearfix">
                    {$dataList->render()}
                </div>
            </div>
        </div>
    </div>
</section>
<script type="text/javascript">
$(function(){
    /*ajax页面加载icheck，有该控件的页面才需要*/
    $('input[type="checkbox"].minimal, input[type="radio"].minimal').iCheck({
        checkboxClass: 'icheckbox_minimal-blue',
        radioClass: 'iradio_minimal-blue'
    });
    
    /*ajax页面加载icheck，有该控件的页面才需要*/
    $(".select2").select2({language:"zh-CN"});
    
    /*全选-反选*/
    $('.checkbox-toggle').on('ifChecked', function(event){
        var _this = $(this);
        var _table = _this.closest('.table');
        _table.find("tr td input[type='checkbox']").iCheck("check");
    });
    $('.checkbox-toggle').on('ifUnchecked', function(event){
        var _this = $(this);
        var _table = _this.closest('.table');
        _table.find("tr td input[type='checkbox']").iCheck("uncheck");
    });
    
    $('.editable').editable({
        emptytext: "empty",
        params: function(params) {      //参数
            var data = {};
            data['id'] = params.pk;
            data[params.name] = params.value;
            return data;
        },
        success: function(response, newValue) {
            var res = $.parseJSON( response );
            if(res.status == 1){
            }else{
                return res.info;
            }
        }
    });
    
    {if condition=" $rest_login == 1 "}
    restlogin('{$rest_login_info}');   //登录超时
    {/if}
})
</script>
{/block}